home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Online / SpeakFreely / src / rtp.h < prev    next >
Text File  |  2000-05-18  |  3KB  |  114 lines

  1. /*
  2. * rtp.h  --  RTP header file
  3. * RTP draft: November 1994 version
  4. *
  5. * $Id: rtp.h,v 1.3 1995/08/17 13:54:58 hgs Exp $
  6. */
  7.  
  8. #define RTP_SEQ_MOD (1<<16)
  9. #define RTP_TS_MOD  (0xffffffff)
  10. /*
  11. * Current type value.
  12. */
  13. #define RTP_VERSION 2
  14.  
  15. #define RTP_MAX_SDES 256   /* maximum text length for SDES */
  16.  
  17. typedef enum {
  18.   RTCP_SR   = 200,
  19.   RTCP_RR   = 201,
  20.   RTCP_SDES = 202,
  21.   RTCP_BYE  = 203,
  22.   RTCP_APP  = 204
  23. } rtcp_type_t;
  24.  
  25. typedef enum {
  26.   RTCP_SDES_END    =  0,
  27.   RTCP_SDES_CNAME  =  1,
  28.   RTCP_SDES_NAME   =  2,
  29.   RTCP_SDES_EMAIL  =  3,
  30.   RTCP_SDES_PHONE  =  4,
  31.   RTCP_SDES_LOC    =  5,
  32.   RTCP_SDES_TOOL   =  6,
  33.   RTCP_SDES_NOTE   =  7,
  34.   RTCP_SDES_PRIV   =  8, 
  35.   RTCP_SDES_IMG    =  9,
  36.   RTCP_SDES_DOOR   = 10,
  37.   RTCP_SDES_SOURCE = 11
  38. } rtcp_sdes_type_t;
  39.  
  40. typedef struct {
  41.   unsigned int version:2;  /* protocol version */
  42.   unsigned int p:1;        /* padding flag */
  43.   unsigned int x:1;        /* header extension flag */
  44.   unsigned int cc:4;       /* CSRC count */
  45.   unsigned int m:1;        /* marker bit */
  46.   unsigned int pt:7;       /* payload type */
  47.   u_int16 seq;             /* sequence number */
  48.   u_int32 ts;              /* timestamp */
  49.   u_int32 ssrc;            /* synchronization source */
  50.   u_int32 csrc[1];         /* optional CSRC list */
  51. } rtp_hdr_t;
  52.  
  53. typedef struct {
  54.   unsigned int version:2;  /* protocol version */
  55.   unsigned int p:1;        /* padding flag */
  56.   unsigned int count:5;    /* varies by payload type */
  57.   unsigned int pt:8;       /* payload type */
  58.   u_int16 length;          /* packet length in words, without this word */
  59. } rtcp_common_t;
  60.  
  61. /* reception report */
  62. typedef struct {
  63.   u_int32 ssrc;            /* data source being reported */
  64.   unsigned int fraction:8; /* fraction lost since last SR/RR */
  65.   int lost:24;             /* cumulative number of packets lost (signed!) */
  66.   u_int32 last_seq;        /* extended last sequence number received */
  67.   u_int32 jitter;          /* interarrival jitter */
  68.   u_int32 lsr;             /* last SR packet from this source */
  69.   u_int32 dlsr;            /* delay since last SR packet */
  70. } rtcp_rr_t;
  71.  
  72. typedef struct {
  73.   u_int8 type;             /* type of SDES item (rtcp_sdes_type_t) */
  74.   u_int8 length;           /* length of SDES item (in octets) */
  75.   char data[1];            /* text, not zero-terminated */
  76. } rtcp_sdes_item_t;
  77.  
  78. /* one RTCP packet */
  79. typedef struct {
  80.   rtcp_common_t common;    /* common header */
  81.   union {
  82.     /* sender report (SR) */
  83.     struct {
  84.       u_int32 ssrc;        /* source this RTCP packet refers to */
  85.       u_int32 ntp_sec;     /* NTP timestamp */
  86.       u_int32 ntp_frac;
  87.       u_int32 rtp_ts;      /* RTP timestamp */
  88.       u_int32 psent;       /* packets sent */
  89.       u_int32 osent;       /* octets sent */ 
  90.       /* variable-length list */
  91.       rtcp_rr_t rr[1];
  92.     } sr;
  93.  
  94.     /* reception report (RR) */
  95.     struct {
  96.       u_int32 ssrc;        /* source this generating this report */
  97.       /* variable-length list */
  98.       rtcp_rr_t rr[1];
  99.     } rr;
  100.  
  101.     /* BYE */
  102.     struct {
  103.       u_int32 src[1];      /* list of sources */
  104.       /* can't express trailing text */
  105.     } bye;
  106.  
  107.     /* source description (SDES) */
  108.     struct rtcp_sdes_t {
  109.       u_int32 src;              /* first SSRC/CSRC */
  110.       rtcp_sdes_item_t item[1]; /* list of SDES items */
  111.     } sdes;
  112.   } r;
  113. } rtcp_t;
  114.